<template>
    <view>
       <!-- <dataTable :thList="thList" :isflag="isflag" :colWidthList="colWidthList" thBgColor="#0096D3" thColor="#fff" thSize="30"
            thHeight="70" borderColor="	White" :tbList="tbData">
        </dataTable> -->
		<dataTable :thList="thList" :isflag="isflag" :colWidthList="colWidthList" :thBgColor="fontcolor.color" thColor="#fff" thSize="30"
		    thHeight="70" :borderColor="fontcolor.color"  :tbList="tbData">
		</dataTable>
		<prompt :visible.sync="promptVisible" :flag="flag" :title="title" style="z-index: 1;" placeholder="输入请设置滚动间隔时间" :isMutipleLine="isMutipleLine" :defaultValue="time"
			@confirm="clickPromptConfirm" :mainColor="fontcolor.color">
		</prompt>
    </view>
</template>

<script>
	import dataTable from '../../components/lun-dataTable/lun-dataTable.vue'
	import Prompt from '../../components/zz-prompt/index.vue';
	export default {
		components: {
			dataTable,
			Prompt,
		},
		data() {
			return {
				fontcolor:{
				color:this.$kdup.color,
				borderBottom:'2px solid '+this.$kdup.color
				},
				bj:{
				backgroundColor:this.$kdup.color,
				},
				color:this.$kdup.color,
				isflag:"1",
				flag:"2",
				time:"10",
				title:"设置间隔时间（秒）",
				isMutipleLine: true, //是否开启大文本
				promptVisible: false, //是否关闭弹出款
				thList: ['订单号','订单行号', '产品编码', '产品名称', '开工时间','完工时间', '计划数','领料套数'
				,'当前工序','汇报数', '不合格数','报废数'
				, '入库数', '入库时间'],
				colWidthList: [250, 150, 300, 400, 200, 200, 200
				,200, 200, 200
				, 200, 200, 200, 200],
				tbData:[],
				pagesize:13,
				pagecur:0,
				timer:null,
				tbList: [
				    ['MO20211111001', '1', '2.1.05.01.01.05',
					'胶件8S317三芯盖', '2021-12-11','2021-12-11','100.00','100.00',
					'开料','200.00','100.00', '100.00'
					 ,'300.00','2021/11/11'],
					['MO20211111001', '1', '2.1.05.01.01.05',
					'胶件8S317三芯盖', '2021-12-11','2021-12-11','100.00','100.00',
					'开料','200.00','100.00', '100.00'
					 ,'300.00','2021/11/11'],
					 ['MO20211111001', '1', '2.1.05.01.01.05',
					 '胶件8S317三芯盖', '2021-12-11','2021-12-11','100.00','100.00',
					 '开料','200.00','100.00', '100.00'
					  ,'300.00','2021/11/11'],
					  ['MO20211111001', '1', '2.1.05.01.01.05',
					  '胶件8S317三芯盖', '2021-12-11','2021-12-11','100.00','100.00',
					  '开料','200.00','100.00', '100.00'
					   ,'300.00','2021/11/11'],
					   ['MO20211111001', '1', '2.1.05.01.01.05',
					   '胶件8S317三芯盖', '2021-12-11','2021-12-11','100.00','100.00',
					   '开料','200.00','100.00', '100.00'
					    ,'300.00','2021/11/11'],
						['MO20211111001', '1', '2.1.05.01.01.05',
						'胶件8S317三芯盖', '2021-12-11','2021-12-11','100.00','100.00',
						'开料','200.00','100.00', '100.00'
						 ,'300.00','2021/11/11'],
						 ['MO20211111001', '1', '2.1.05.01.01.05',
						 '胶件8S317三芯盖', '2021-12-11','2021-12-11','100.00','100.00',
						 '开料','200.00','100.00', '100.00'
						  ,'300.00','2021/11/11'],
						  ['MO20211111001', '1', '2.1.05.01.01.05',
						  '胶件8S317三芯盖', '2021-12-11','2021-12-11','100.00','100.00',
						  '开料','200.00','100.00', '100.00'
						   ,'300.00','2021/11/11'],
						   ['MO20211111001', '1', '2.1.05.01.01.05',
						   '胶件8S317三芯盖', '2021-12-11','2021-12-11','100.00','100.00',
						   '开料','200.00','100.00', '100.00'
						    ,'300.00','2021/11/11'],
							['MO20211111001', '1', '2.1.05.01.01.05',
							'胶件8S317三芯盖', '2021-12-11','2021-12-11','100.00','100.00',
							'开料','200.00','100.00', '100.00'
							 ,'300.00','2021/11/11'],
							 ['MO20211111001', '1', '2.1.05.01.01.05',
							 '胶件8S317三芯盖', '2021-12-11','2021-12-11','100.00','100.00',
							 '开料','200.00','100.00', '100.00'
							  ,'300.00','2021/11/11'],
							  ['MO20211111001', '1', '2.1.05.01.01.05',
							  '胶件8S317三芯盖', '2021-12-11','2021-12-11','100.00','100.00',
							  '开料','200.00','100.00', '100.00'
							   ,'300.00','2021/11/11'],
							   ['MO20211111001', '1', '2.1.05.01.01.05',
							   '胶件8S317三芯盖', '2021-12-11','2021-12-11','100.00','100.00',
							   '开料','200.00','100.00', '100.00'
							    ,'300.00','2021/11/11'],
								['MO20211111001', '1', '2.1.05.01.01.05',
								'胶件8S317三芯盖', '2021-12-11','2021-12-11','100.00','100.00',
								'开料','200.00','100.00', '100.00'
								 ,'300.00','2021/11/11'],
								 ['MO20211111001', '1', '2.1.05.01.01.05',
								 '胶件8S317三芯盖', '2021-12-11','2021-12-11','100.00','100.00',
								 '开料','200.00','100.00', '100.00'
								  ,'300.00','2021/11/11'],
								
					
					
				]
			}
		},
		onUnload() {
		if(this.timer) {  
				clearTimeout(this.timer);  
				this.timer = null;  
			}
		},
		onNavigationBarButtonTap (e){  
		if(e.text=="滚动间隔时间"){
		this.promptVisible = true;
		} 
		},
		onHide() {
		if(this.timer) {  
				clearTimeout(this.timer);  
				this.timer = null;  
			}
		},
		onShow() {
			uni.setNavigationBarColor({
				frontColor: "#ffffff",	//文字颜色
				backgroundColor: this.$kdup.color	//底部背景色
			})
			this.initData();
		},
		methods: {
			initData(){
			this.init()
			this.timer = setInterval(() => { 
			this.Inter();	
			console.log( (this.time*1000))
			}, (this.time*1000))	
			},
			init(){
				for(var i=this.pagecur;i<this.pagesize;i++){
					this.tbData.push(this.tbList[i]);
				}
				console.log(this.tbData)
			},
			Inter(){
			 	this.pagecur+=13;
				this.pagesize+=13;
				if((this.tbList.length-this.pagecur)<=0){
					 this.pagecur=0;
					 this.pagesize=13;
				}
				this.tbData=[];
				this.init();
			},
			clickPromptConfirm(val) {
		    this.time=val;
			uni.showToast({
				icon: 'none',
				title: '滚动间隔时间是：'+this.time+'秒',
				duration: 2000
			});
			if(this.timer) {
				clearTimeout(this.timer);  
				this.timer = null;  
			}
			this.initData();
			},
		}
	}
</script>

<style>

</style>
